package com.thoughtworks.university.biblioteca;

import java.util.ArrayList;

/**
 * Created by sravanns on 10/06/14.
 */
public class ListBooks {
    static ArrayList<Book> list_of_books=new ArrayList<Book>(){{add(new Book("c","Dennis",1990));add(new Book("java","james",1991));add(new Book("c++","bala",1992));add(new Book("android","sravanthi",1993));}};

    public static ArrayList<Book> return_list_of_books() {

        return list_of_books;
    }
    public void doAction()
    {
        ArrayList<Book> templist;
        templist=list_of_books;
        BibliotecaApp obj=new BibliotecaApp();
        int size=obj.checked_out_list.size();
        int pointer=0;
        while(pointer<size)
        {
            templist.remove(obj.checked_out_list.get(pointer));
            pointer++;
        }
        pointer=0;
        while(pointer<templist.size())
        {

            System.out.println("\n-------\n"+templist.get(pointer).toString());
            pointer++;
        }

    }

    public Book is_available_catalog(String name)
    {
        int pointer=0;
        while(pointer<list_of_books.size())
        {
            if(name.equalsIgnoreCase(list_of_books.get(pointer).book_name))
            {
                return list_of_books.get(pointer);
            }
            pointer++;
        }
        return null;
    }
}